<?php
namespace app\facescore\home;
use app\common\controller\Common;
use think\Db;
class Index extends Common
{
    public function index()
    {
        return $this->fetch();
    }

    /**
     * 轮播图
     * @return \think\response\Json
     */
    public function banner()
    {
        $data_list = Db::name('facescore_banner')->where('status',1)->order('shunxu desc')->select();
        //给字段值为img的图片地址拼接一个前缀
        $data_list = imgValues($data_list,'img');
        return json($data_list);
    }

    /**
     * 打赏价格配置
     */
    public function reward_config(){
        $data_list = array();
        $data_list['rmb'] = config('module_facescore.rmb_reward_config');
        $data_list['mag'] = config('module_facescore.mag_reward_config');
        return json($data_list);
    }

    /**
     * 返回一些设置信息 啦啦啦
     */
    public function setting(){
        $data = [
            'is_wxpay' => config('module_facescore.is_wxpay'),
            'whatsMag' => config('module_facescore.whatsMag'),
            'mag_text' => config('module_facescore.mag_text'),
            'trial_mode' => config('module_facescore.trial_mode'),
            'cash_limit' => config('module_facescore.cash_limit'),
            'invi_award' => config('module_facescore.invi_award'),
            'new_award' => config('module_facescore.new_award'),
            'reward_rules' => config('module_facescore.reward_rules')
        ];

        return json($data);
    }
}